package com.appprogram.baseapppackage;

import android.app.Application;
import android.content.Context;

import androidx.annotation.NonNull;
import androidx.camera.camera2.Camera2Config;
import androidx.camera.core.CameraXConfig;

import com.facebook.drawee.backends.pipeline.Fresco;
import com.luck.picture.lib.app.IApp;
import com.luck.picture.lib.app.PictureAppMaster;

/**
 * BaseAppPackage com.appprogram.baseapppackage
 * 2020-01-08 09:27
 */
public class MyApplication extends Application implements IApp, CameraXConfig.Provider{
    private static MyApplication sMyApplication;

    public static MyApplication getInstance() {
        if (null == sMyApplication) {
            synchronized (MyApplication.class) {
                if (null == sMyApplication) sMyApplication = new MyApplication();
            }
        }
        return sMyApplication;
    }

    @Override
    public void onCreate() {
        super.onCreate();
        PictureAppMaster.getInstance().setApp(this);
        //初始化Fresco
        Fresco.initialize(this);
    }

    @NonNull
    @Override
    public CameraXConfig getCameraXConfig() {
        return Camera2Config.defaultConfig();
    }

    @Override
    public Context getAppContext() {
        return this;
    }
}
